function res = getProbeSignal(obj, varargin)
%GETPROBESIGNAL Summary of this function goes here
%   Detailed explanation goes here
    p=inputParser;
    isnonneg = @(x) x > 0;
    dmTest = @(x) ismember(x, {'time', 'frequency'});
    winTest = @(x) ismember(x, {'rect', 'hann', 'hamming', 'BH'});
    p.addParameter('domain', 'time', dmTest);
    p.addParameter('fft_win', 'hann', winTest);
    p.addParameter('acquisition_time', 60, isnonneg);
    p.parse(varargin{:});
    
    sess = obj.session;
    zi=sess.getDevice(obj.master);
    scope = zi.scopeModule(sess);

    %% input
    scope.enableChannel('both');
    scope.inputSelect('0', 0); % Signal Input 1
    scope.inputSelect('1', 12);% Signal Output 1
    
    %% mode
    scope.setMode(p.Results.domain);
    switch p.Results.domain
        case 'time'
            scope.setSamplingRate( 0 ); % 0 -> 60 MHz
            scope.setLength( 16384 ); %  16384pts * 60 MHz = 273 us
            scope.setContinuousAcquisition( 1 ); % average 1 s
            scope.setAveraging( 100 );
        case 'frequency'
            scope.setSamplingRate( 7 ); % 7 -> 469 kHz
            scope.setLength( 524288 ); %  524288 pts * 469 kHz = 1.05 s, f_resolution = 894 mHz
            scope.setContinuousAcquisition( p.Results.acquisition_time ); % average 20 s
            scope.setAveraging( 100 );
            scope.setFFTWindow( p.Results.fft_win );
    end

    %% Trigger
    scope.setTriggerChannel(10);
    scope.setTriggerLevel(0.0)
    scope.enableTrigger();
    
    %% acq
    scope.subscribeChannel();
    res=scope.run();
    scope.unsubscribeChannel();
end

